# 定义字典
my_dict = {"王力宏": 99, "周杰伦": 88, "林俊杰": 77}
# 定义空字典
my_dict2 = {}
my_dict3 = dict()
print(my_dict, type(my_dict))
print(my_dict2, type(my_dict2))
print(my_dict3, type(my_dict3))

# 定义重复Key的字典
# my_dict = {"王力宏":99, "周杰伦":88, "林俊杰":77, "王力宏":66}
# print(my_dict)

# 通过key获取value
my_dict = {"王力宏": 99, "周杰伦": 88, "林俊杰": 77}
score = my_dict["王力宏"]
print(f"王力宏的成绩是：{score}")
score2 = my_dict["周杰伦"]
print(f"周杰伦的成绩是：{score2}")

# 记录学生各科的考试信息
my_dict4 = {
    "王力宏": {
        "语文": 77,
        "数学": 66,
        "英语": 33
    },
    "周杰伦": {
        "语文": 88,
        "数学": 86,
        "英语": 55}
    ,
    "林俊杰": {
        "语文": 99,
        "数学": 96,
        "英语": 66
    }
}
print(my_dict4)
# 从嵌套字典中获取数据
score3 = my_dict4["周杰伦"]["语文"]
print(f"周杰伦的语文成绩是：{score3}")
